package com.ants.boot.test.utils;
import com.ants.boot.test.domain.UserInfo;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

/**
 * @author : 蚂蚁会花呗
 * @date : 2023-10-27 16:33
 **/
public class PasswordHelper {
	public static UserInfo encryptPassword(UserInfo user) {
		String algorithmName = "md5";
		int hashIterations = 2;
		String newPassword = new SimpleHash(algorithmName, //用户名
				user.getPassword(), //密码
				ByteSource.Util.bytes(user.getAccountNumber()),
				hashIterations
				 ).toHex();
		user.setPassword(newPassword);
		return user;
	}

	public static void main(String[] args) {
		//bd089d71c9e330f019a01f316937519c  Lztest@2023
		/*UserInfo user = new UserInfo();
		user.setAccountNumber("194");
		user.setPassword("Lz194@123456");
		System.out.println(encryptPassword(user).getPassword());
		String oldpassword = AESHelper.aesDecrypt("+rLfsM64FtYbyJmSMPDH1w==");
		System.out.println(oldpassword);*/

		for (int i=0;i<5768;i++){
			System.out.println(IdWorker.get32UUID());
		}


	}

}